/**
 * @class 室女座超星系团对象实体
 * @author DuskyHuang 圣子
 * @description 女座超星系团既本超星系团是本星系群更上一级的范围系统，包含本星系群、室女座星系团等多个星系群/团的离散系统。
*/

import { _decorator, instantiate } from 'cc';
import { LAYER_MAIN_3D, Res } from 'const';
import { createNodeAt, setParticles } from 'helpers';
import { core } from 'cfw';
import { CosmicScope } from './cosmic-scope';
import { Task, TaskNames } from 'notifications';
const { ccclass } = _decorator;

@ccclass('cocosmos.VirgoSuperCluster')
export class VirgoSuperCluster extends CosmicScope {

    protected _substructure_key: substructures = 'groups';
    protected _attenuation: attenuation = [7.0, 7.7, 8.7, 9.15];

    protected createSubParticles(): void {
        this._subparts = createNodeAt("Perversive Galaxy-Groups", LAYER_MAIN_3D, this.node);
        const GalaxiesGUP = core.res.getPrefab(GALAXIES_GPU);
        [NearGroups, SouthernGroups, WesternGroups, NorthGroups].forEach(args =>
            setParticles(instantiate(GalaxiesGUP), args, this._subparts));
    }

    protected approachScope1stTime(): void {
        // GPU Particle Texture Seems Not Support Dynamic Loading
        // core.notify(Task.Load.DYNAMIC_TEX, TaskNames.TEX_RDM_GALAXIES);
    }
}

const { Prefabs: { GALAXIES_GPU } } = Res;

const NearGroups: IParticleLike = {
    num: 1200,
    sizes: [0.0024, 0.0036],
    radius: 0.15,
    position: { x: 0.05, y: 0.15, z: -0.4 },
    scale: { x: 1, y: 1, z: 3 },
    thickness: 0.5,
    random: 0.1,
};

const SouthernGroups: IParticleLike = {
    num: 1500,
    sizes: [0.004, 0.006],
    radius: 0.4,
    position: { x: 0, y: -0.25, z: 0.5 },
    scale: { x: 2.5, y: 1.5, z: 1.2 },
    thickness: 0.5,
    random: 0.2,
};

const WesternGroups: IParticleLike = {
    num: 2200,
    sizes: [0.006, 0.01],
    radius: 0.6,
    position: { x: 0, y: -0.8, z: -2. },
    scale: { x: 3, y: 1.5, z: 2.2 },
    thickness: 0.5,
    random: 0.2,
};

const NorthGroups: IParticleLike = {
    num: 2000,
    sizes: [0.005, 0.008],
    radius: 0.6,
    position: { x: 0.5, y: 1, z: -0.5 },
    scale: { x: 4, y: 1, z: 4 },
    thickness: 0.5,
    random: 0.2,
};